var _n44;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $1$ResourceLoader = require("ResourceLoader");
var s = cc__importDefault($1$ResourceLoader);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
cc__decorator.property;
var def_TmpRope = function (t) {
  function _ctor() {
    const instance = null !== t && t.apply(this, arguments) || this; // 使用更具描述性的变量名

    // 初始化属性
    instance.type = -1;
    instance.isAnimated = false;

    return instance;
  }
  cc__extends(_ctor, t);
  _ctor.prototype.start = function () { };
  _ctor.prototype.setType = function (t, e) {
    // 设置默认值
    if (undefined === e) {
      e = true;
    }

    // 设置类型
    this.type = t;

    // 获取当前实例
    const context = this;

    // 加载并动画处理子节点
    const animateChild = (index) => {
      const childNode = context.node.children[index];
      const spriteComponent = childNode.getComponent(cc.Sprite);

      // 加载精灵帧
      s.default.getInstance().load("Feibiao", "rope/tmp/" + (t + 1), cc.SpriteFrame)
        .then((spriteFrame) => {
          spriteComponent.spriteFrame = spriteFrame;
          childNode.opacity = 0;
          cc.tween(childNode)
            .delay(0.1 * index)
            .to(0.2, { opacity: 255 })
            .start();
        });
    };

    // 遍历子节点并应用动画
    for (let i = 0; i < this.node.children.length; i++) {
      animateChild(i);
    }

    // 动画状态设置
    this.isAnimated = e;

  };
  _ctor.prototype.removeFromBoard = function () { };
  _ctor.prototype.moveStart = function (t) {
    // 记录开始移动
    cc.log("tmp rope moveStart");

    // 创建动画并启动
    cc.tween(this.node)
      .to(0.3, { scale: 0.2 }) // 动画持续时间及目标缩放
      .call(() => {
        t(); // 动画完成后调用回调函数
      })
      .start();
  };
  return cc__decorate([ccp_ccclass], _ctor);
}(cc.Component);
exports.default = def_TmpRope;